package com.shangji.homework4;

import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class Homework4Test {
	@Test
	public void proxyFactoryBeanTest() {
		ApplicationContext applicationContext = new ClassPathXmlApplicationContext("proxyFactoryBean.xml");
		UserDao userDao = (UserDao) applicationContext.getBean("userDaoProxy");
		userDao.add();
		userDao.delete();
	}
	@Test
	public void aspectjTest() {
		ApplicationContext applicationContext = new ClassPathXmlApplicationContext("aspectj.xml");
		UserDao userDao = (UserDao) applicationContext.getBean("userDao");
		userDao.add();
		userDao.delete();
	}
	@Test
	public void aspectjAnnotationTest() {
		ApplicationContext applicationContext = new ClassPathXmlApplicationContext("aspectj-annotation.xml");
		UserDao userDao = (UserDao) applicationContext.getBean("userDao");
		userDao.add();
		userDao.delete();
	}
}
